package fr.ece.ing4.rpc;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Player {

	private String name;
	private int score;
	private List<RPSEnum> moves;
	private Iterator<RPSEnum> iterator;
	
	public Player(String name, List<RPSEnum> moves) {
		this.name = name;
		score = 0;
		this.moves = moves;
		iterator = this.moves.iterator();
	}
	
	public Player(String name) {
		this.name = name;
		score = 0;
		moves = aleaFill(10);
		iterator = moves.iterator();
	}
	
	public static ArrayList<RPSEnum> aleaFill (int num){
		
		ArrayList<RPSEnum> m = new ArrayList<RPSEnum>();
		
		for(int i = 0; i < num; i++){
			m.add(RPSEnum.getRandom());
		}
		
		return m;
	}
	
	public String getName(){
		return name;
	}
	
	public int getScore(){
		return score;
	}
	
	public int getNumOfMoves(){
		return moves.size();
	}
	
	public RPSEnum getNextMove(){
		return iterator.next();
	}
	
	public Boolean hasNextMove(){
		return iterator.hasNext();
	}
	
	public void setScore(int s){
		score = s;
	}
	
}
